﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="recordlist.aspx.cs" MasterPageFile="~/Site.master" Inherits="codelist" %>

    <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

    <div style="width: 927px; " class="liststly">
        
    
    <asp:GridView ID="gv_record" runat="server" AutoGenerateColumns="False" CellPadding="4"

                        ForeColor="#333333" OnRowCreated="gv_RowCreated"
             DataKeyNames="iStaff_ID" 
            DataSourceID="SqlDataSource1"  ShowFooter ="True" GridLines="None" 
            Width="928px" style="margin-left: 0px"
            >

                        <EditRowStyle BackColor="#2461BF" />

                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />

                        <AlternatingRowStyle BackColor="White" />

                        <Columns>
                            <asp:BoundField DataField="iStaff_ID" HeaderText="员工编号" 
                                SortExpression="iStaff_ID" >
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="sName" HeaderText="姓名" 
                                SortExpression="sName" >
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="dBirth" HeaderText="出生年月日" 
                                SortExpression="dBirth" >
                            <HeaderStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="iSex" HeaderText="姓别" 
                                SortExpression="iSex" >
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="cName" HeaderText="文化程度" SortExpression="cName" >

                            

                            <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>

                            

                            <asp:BoundField DataField="sHealthy" HeaderText="健康" 
                                SortExpression="sHealthy">
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="sPolitics" HeaderText="政治面貌" 
                                SortExpression="sPolitics" >
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="dName" HeaderText="部门" SortExpression="dName" >
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="pName" HeaderText="职位" SortExpression="pName" >

                            <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>

                            <asp:BoundField DataField="sRemark" HeaderText="备注" 
                                SortExpression="sRemark" >

                            <ItemStyle HorizontalAlign="Center" Width="200px" />
                            </asp:BoundField>

                            <asp:TemplateField HeaderText="档案下载">
                               <ItemTemplate>

                                    <asp:LinkButton ID="lbtn_down" runat="server" OnClick="btn_down" >下载</asp:LinkButton>
                                
                              </ItemTemplate>

                               <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>

                            <asp:CommandField ShowDeleteButton="True"  HeaderText="操作"/>

                        </Columns>

                        <RowStyle BackColor="#EFF3FB" />

                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />

                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />

                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />

                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />

                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:DevMgmntConnectionString %>" 
            SelectCommand="SELECT a.* ,t1.sCultureName cName,t2.sDepartmentName dName,t3.sProfessionaName pName
FROM t_record a left join t_culture t1 on t1.iCulture_ID = a.iCulture_ID 
left join t_department t2 on t2.iDepartment_ID = a.iDepartment_ID 
left join t_professiona t3 on t3.iProfessiona_ID = a.iProfessiona_ID  " 

            DeleteCommand="DELETE FROM [t_record] WHERE [iStaff_ID] = @iStaff_ID" 
            
            UpdateCommand="UPDATE [t_record] SET [sName] = @sName, [dBirth] = @dBirth, [iSex] = @iSex, [iCulture_ID] = @iCulture_ID, [sHealthy] = @sHealthy, [sPolitics] = @sPolitics, [iProfessiona_ID] = @iProfessiona_ID, [sRemark] = @sRemark, [iDepartment_ID] = @iDepartment_ID WHERE [iStaff_ID] = @iStaff_ID" 
            
            
            InsertCommand="INSERT INTO [t_record] ([sName], [dBirth], [iSex], [iCulture_ID], [sHealthy], [sPolitics], [iProfessiona_ID], [sRemark], [iDepartment_ID]) VALUES (@sName, @dBirth, @iSex, @iCulture_ID, @sHealthy, @sPolitics, @iProfessiona_ID, @sRemark, @iDepartment_ID)">
                        <DeleteParameters>
                            <asp:Parameter Name="iStaff_ID" Type="Int32" />
                        </DeleteParameters>
          
                        <InsertParameters>
                            <asp:Parameter Name="sName" Type="String" />
                            <asp:Parameter Name="dBirth" Type="String" />
                            <asp:Parameter Name="iSex" Type="String" />
                            <asp:Parameter Name="iCulture_ID" Type="Int32" />
                            <asp:Parameter Name="sHealthy" Type="String" />
                            <asp:Parameter Name="sPolitics" Type="String" />
                            <asp:Parameter Name="iProfessiona_ID" Type="Int32" />
                            <asp:Parameter Name="sRemark" Type="String" />
                            <asp:Parameter Name="iDepartment_ID" Type="Int32" />
                        </InsertParameters>
          
                        <UpdateParameters>
                            <asp:Parameter Name="sName" Type="String" />
                            <asp:Parameter Name="dBirth" Type="String" />
                            <asp:Parameter Name="iSex" Type="String" />
                            <asp:Parameter Name="iCulture_ID" Type="Int32" />
                            <asp:Parameter Name="sHealthy" Type="String" />
                            <asp:Parameter Name="sPolitics" Type="String" />
                            <asp:Parameter Name="iProfessiona_ID" Type="Int32" />
                            <asp:Parameter Name="sRemark" Type="String" />
                            <asp:Parameter Name="iDepartment_ID" Type="Int32" />
                            <asp:Parameter Name="iStaff_ID" Type="Int32" />
                        </UpdateParameters>
        </asp:SqlDataSource>

        <asp:Label ID="Label10" runat=server BackColor="Aqua" Font-Bold="True" Height="25px" 
            style="margin-top: 0px; text-align:center" Width="929px">信息录入</asp:Label>
        <asp:Panel ID="Panel1" runat="server" Width="922px">
            <asp:Label ID="Label1" runat="server" Text="姓名："></asp:Label>
            <asp:TextBox ID="tx_name" runat="server" Width="77px"></asp:TextBox>
            &nbsp;&nbsp;
            <asp:Label ID="Label2" runat="server" Text="出生年月日："></asp:Label>
            <asp:TextBox ID="tx_birth" runat="server" Width="96px"></asp:TextBox>
             &nbsp;&nbsp;&nbsp;<asp:Label ID="Label3" runat="server" Text="姓别："></asp:Label>
            <asp:DropDownList ID="sel_sex" runat="server">
                <asp:ListItem>男</asp:ListItem>
                <asp:ListItem>女</asp:ListItem>
            </asp:DropDownList>
            &nbsp;&nbsp;
            <asp:Label ID="Label4" runat="server" Text="文化程度："></asp:Label>
            <asp:DropDownList ID="sel_culture" runat="server" DataSourceID="SqlDataSource2" 
                DataTextField="sCultureName" DataValueField="iCulture_ID">
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:DevMgmntConnectionString %>" 
                SelectCommand="SELECT * FROM [t_culture]"></asp:SqlDataSource>
            &nbsp;&nbsp;&nbsp;
            <asp:Label ID="Label5" runat="server" Text="健康："></asp:Label>
            <asp:DropDownList ID="sel_healthy" runat="server">
                <asp:ListItem>是</asp:ListItem>
                <asp:ListItem>否</asp:ListItem>
            </asp:DropDownList>
            &nbsp;
            <asp:Label ID="Label6" runat="server" Text="政治面貌："></asp:Label>
            <asp:TextBox ID="tx_politics" runat="server" Width="71px"></asp:TextBox>
            &nbsp;
            <br />
            <asp:Label ID="Label7" runat="server" Text="部门："></asp:Label>
            <asp:DropDownList ID="sel_department" runat="server" 
                DataSourceID="SqlDataSource3" DataTextField="sDepartmentName" 
                DataValueField="iDepartment_ID">
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                ConnectionString="<%$ ConnectionStrings:DevMgmntConnectionString %>" 
                SelectCommand="SELECT * FROM [t_department]"></asp:SqlDataSource>
            &nbsp;&nbsp;
            <asp:Label ID="Label8" runat="server" Text="职位："></asp:Label>
            <asp:DropDownList ID="sel_professiona" runat="server" 
                DataSourceID="SqlDataSource4" DataTextField="sProfessionaName" 
                DataValueField="iProfessiona_ID">
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
                ConnectionString="<%$ ConnectionStrings:DevMgmntConnectionString %>" 
                SelectCommand="SELECT * FROM [t_professiona]"></asp:SqlDataSource>
            &nbsp;&nbsp;
            <asp:Label ID="Label9" runat="server" Text="备注："></asp:Label>
            <asp:TextBox ID="tx_master" runat="server" Width="397px"></asp:TextBox>
            &nbsp;&nbsp;&nbsp;
             <br />
             &nbsp;&nbsp;&nbsp;<asp:Label ID="Label11" runat="server" Text="选择要上传的档案文件："></asp:Label>
             <input type="file" id="UPLOADfile" runat="server" />
            &nbsp;&nbsp;
            <asp:Label ID="TX_UPLOAD" runat="server" Text="" Style="color: Red"></asp:Label>
            <br />
            <br />
            <center>
            <asp:Button ID="bt_recordAdd" runat="server" onclick="bt_recordAdd_Click" 
                Text="添加" />
                </center>
        </asp:Panel>
                   
    </div>
    </asp:Content>
 
